package com.example.coinhelper.Bean;

import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.NonNull;

public class Details implements Parcelable {
    private long id;
    private String username;
    private String date;
    private String operation;
    private double money;
    private int icon;
    private String other;

    // 构造函数
    public Details(String username, String date, String operation, double money, int icon,String other) {
        this.username = username;
        this.date = date;
        this.operation = operation;
        this.money = money;
        this.icon = icon;
        this.other = other;
    }
    public Details(){

    }

    protected Details(Parcel in) {
        id = in.readLong();
        username = in.readString();
        date = in.readString();
        operation = in.readString();
        money = in.readDouble();
        icon = in.readInt();
        other = in.readString();
    }

    public static final Creator<Details> CREATOR = new Creator<Details>() {
        @Override
        public Details createFromParcel(Parcel in) {
            return new Details(in);
        }

        @Override
        public Details[] newArray(int size) {
            return new Details[size];
        }
    };

    // toString() 方法
    @NonNull
    @Override
    public String toString() {
        return "Details{" +
                "username='" + username + '\'' +
                ", date='" + date + '\'' +
                ", operation='" + operation + '\'' +
                ", money=" + money +
                ", icon=" + icon +
                ", other=" + other+
                '}';
    }

    // get 和 set 方法
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getOperation() {
        return operation;
    }

    public void setOperation(String operation) {
        this.operation = operation;
    }

    public double getMoney() {
        return money;
    }

    public void setMoney(double money) {
        this.money = money;
    }

    public int getIcon() {
        return icon;
    }

    public void setIcon(int icon) {
        this.icon = icon;
    }

    public String getOther() {
        return other;
    }

    public void setOther(String other) {
        this.other = other;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeLong(id);
        dest.writeString(username);
        dest.writeString(date);
        dest.writeString(operation);
        dest.writeDouble(money);
        dest.writeInt(icon);
        dest.writeString(other);
    }
}

